Skip to content

Task 4 enhance error handling#23

Merged
godely merged 9 commits intomainfrom
task-4-enhance-error-handling
Jun 21, 2025
Merged

Task 4 enhance error handling#23
godely merged 9 commits intomainfrom
task-4-enhance-error-handling

Conversation

@godely
Copy link
Copy Markdown
Owner

@godely godely commented Jun 21, 2025

No description provided.

godely and others added 9 commits June 8, 2025 10:33
- Refactor OuraClient._make_request to handle URL construction centrally
- Add logic to ensure endpoints start with / and remove duplicate /v2 prefixes
- Update all endpoint modules to use relative paths without /v2 prefix
- Update all tests to match new URL construction pattern
- All 101 tests passing

This fixes issue #8 where URLs were constructed as:
https://api.ouraring.com/v2/v2/usercollection/...

Now they correctly resolve to:
https://api.ouraring.com/v2/usercollection/...

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Create build_query_params utility function in oura_api_client/utils
- Handles date conversion from date objects to ISO strings
- Filters out None values automatically
- Refactor all endpoint modules to use the new utility
- Reduces code duplication across 16 endpoint files
- All 101 tests passing

This centralizes the common pattern:
- Converting date objects to ISO format strings
- Building params dict with start_date, end_date, next_token
- Filtering out None values

Closes #9

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix undefined variable in ring_configuration.py
- Remove unused List import from webhook.py
- Add newline at end of query_params.py
- Migrate heartrate.py and personal.py from dataclasses to Pydantic BaseModel
- Fix critical formatting issues in daily_sleep.py with proper indentation
- Make sleep.py self-contained by defining its own contributor models
- Remove cross-file imports that created tight coupling between models
- Update test imports to use correct model types for each endpoint
- Maintain backward compatibility with from_dict() methods
- All 101 tests passing, flake8 clean

This standardizes all 20 model files to use Pydantic BaseModel consistently,
improving code maintainability and reducing coupling between modules.

Closes #10

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Added a robust error handling system with:
- Custom exception hierarchy for specific HTTP error codes
- Automatic retry logic with exponential backoff for transient failures
- Rate limit handling with Retry-After header support
- Configurable retry behavior via RetryConfig
- Comprehensive test coverage for all error scenarios

Also added CLAUDE.md for project-specific instructions to maintain
consistency and best practices.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update test to use specific ConnectionError instead of generic RequestException
- Fix flake8 issues by removing unused import
- Refactor parse_openapi.py to reduce complexity
Fix test incompatibilities with new error handling:
- Update 6 tests to use proper mock patterns with response.ok/status_code
- Replace deprecated raise_for_status.side_effect with create_api_error flow
- All previously failing tests now pass

Add parallel test execution for faster development:
- Add pytest-xdist to requirements-dev.txt
- Enable parallel testing with 'pytest -n auto' (14 workers on M4 Pro)
- Reduce test execution time from 2+ minutes to under 1 second

Enhance CLAUDE.md with debugging best practices:
- Add systematic test failure debugging approaches
- Document pytest strategies for isolation and targeted testing
- Include lessons learned about CI timeouts vs actual failures
- Update project commands to use parallel testing by default

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add threshold-based re-reading (85%/25%/20-message rule) to minimize token waste
- Emphasize that mid-session context loss should be rare
- Include explicit uncertainty handling option
- Complete session continuity system documentation
- Update .gitignore to keep context files local and private

Technical architecture and direction by Gustavo Stor
@godely godely merged commit 3b7db38 into main Jun 21, 2025
1 check passed
@godely godely deleted the task-4-enhance-error-handling branch June 21, 2025 13:36
@godely godely linked an issue Jun 22, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task 4: Enhance error handling and retry logic

1 participant